﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace SiruEngine.Graphics
{
	/// <summary>
	/// Custom vertex type for vertices that have just a
	/// position and a normal, without any texture coordinates.
	/// </summary>
    public struct VertexPositionNormal : IVertexType
	{
		public Vector3 Position;
		public Vector3 Normal;


		/// <summary>
		/// Constructor.
		/// </summary>
		public VertexPositionNormal(Vector3 position, Vector3 normal)
		{
			Position = position;
			Normal = normal;
		}


		/// <summary>
		/// Vertex format information, used to create a VertexDeclaration.
		/// </summary>
		public static readonly VertexElement[] VertexElements =
        {
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
        };

        // @note: http://blogs.msdn.com/b/shawnhar/archive/2010/04/19/vertex-data-in-xna-game-studio-4-0.aspx
        public static readonly VertexDeclaration VertexDeclaration =
            new VertexDeclaration(VertexElements);


        VertexDeclaration IVertexType.VertexDeclaration { get { return VertexDeclaration; } }
		/// <summary>
		/// Size of this vertex type.
		/// </summary>
		public const int SizeInBytes = 24;
	}
}
